{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# hvPlot.step\n",
    "\n",
    "```{eval-rst}\n",
    ".. currentmodule:: hvplot\n",
    "\n",
    ".. automethod:: hvPlot.step\n",
    "```\n",
    "\n",
    "## Backend-specific styling options\n",
    "\n",
    "```{eval-rst}\n",
    ".. backend-styling-options:: step\n",
    "```\n",
    "\n",
    "## Examples\n",
    "\n",
    "### Basic step plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import hvplot.pandas  # noqa\n",
    "import pandas as pd\n",
    "\n",
    "df = pd.DataFrame({\"y\": [0, 1, 4, 2]})\n",
    "\n",
    "df.hvplot.step()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Basic step plot for stock prices\n",
    "\n",
    "This example shows Apple’s adjusted closing prices using a step plot to visualize discrete daily changes."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import hvplot.pandas # noqa\n",
    "\n",
    "df = hvplot.sampledata.apple_stocks(\"pandas\")\n",
    "\n",
    "df[:50].hvplot.step(x='date', y='adj_close')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Customize the interpolation method with `where`\n",
    "\n",
    "The `where` keyword allows to control the transition point of the step along the x-axis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import hvplot.pandas  # noqa\n",
    "import pandas as pd\n",
    "\n",
    "df = pd.DataFrame({\"y\": [0, 1, 2]})\n",
    "\n",
    "df.hvplot.step(where=\"pre\", color=\"blue\", label=\"pre\", alpha=.5) *\\\n",
    "df.hvplot.step(color=\"red\", label=\"mid (default)\", alpha=.5) *\\\n",
    "df.hvplot.step(where=\"post\", color=\"green\", label=\"post\", alpha=.5) *\\\n",
    "df.hvplot.scatter(color=\"black\", padding=0.1)"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
